wizard/flow2authwidget.cpp
wizard/owncloudsetuppage.h
wizard/owncloudsetuppage.cpp
+ wizard/termsofservicewizardpage.h
+ wizard/termsofservicewizardpage.cpp
wizard/owncloudwizardcommon.h
wizard/owncloudwizardcommon.cpp
wizard/owncloudwizard.h
int Flow2AuthCredsPage::nextId() const
{
- return WizardCommon::Page_AdvancedSetup;
+ return WizardCommon::Page_TermsOfService;
}
void Flow2AuthCredsPage::setConnected()
#include "wizard/welcomepage.h"
#include "wizard/owncloudsetuppage.h"
#include "wizard/owncloudhttpcredspage.h"
+#include "wizard/termsofservicewizardpage.h"
#include "wizard/owncloudadvancedsetuppage.h"
#include "wizard/webviewpage.h"
#include "wizard/flow2authcredspage.h"
void OwncloudWizard::successfulStep()
{
- const int id(currentId());
+ const WizardCommon::Pages id{static_cast<WizardCommon::Pages>(currentId())};
switch (id) {
+ case WizardCommon::Page_Welcome:
+ break;
+
case WizardCommon::Page_HttpCreds:
_httpCredsPage->setConnected();
break;
break;
#endif // WITH_WEBENGINE
+ case WizardCommon::Page_TermsOfService:
+ _termsOfServicePage->initializePage();
+ break;
+
case WizardCommon::Page_AdvancedSetup:
_advancedSetupPage->directoriesCreated();
break;
void OwncloudWizard::displayError(const QString &msg, bool retryHTTPonly)
{
- switch (currentId()) {
+ switch (static_cast<WizardCommon::Pages>(currentId())) {
+ case WizardCommon::Page_Welcome:
+ case WizardCommon::Page_Flow2AuthCreds:
+ case WizardCommon::Page_WebView:
+ case WizardCommon::Page_TermsOfService:
+ break;
+
case WizardCommon::Page_ServerSetup:
_setupPage->setErrorString(msg, retryHTTPonly);
break;
class WelcomePage;
class OwncloudSetupPage;
class OwncloudHttpCredsPage;
+class TermsOfServiceWizardPage;
class OwncloudAdvancedSetupPage;
class OwncloudWizardResultPage;
class AbstractCredentials;
[[nodiscard]] QList<QSize> calculateWizardPageSizes() const;
AccountPtr _account;
- WelcomePage *_welcomePage;
- OwncloudSetupPage *_setupPage;
- OwncloudHttpCredsPage *_httpCredsPage;
- Flow2AuthCredsPage *_flow2CredsPage;
- OwncloudAdvancedSetupPage *_advancedSetupPage;
+ WelcomePage *_welcomePage = nullptr;
+ OwncloudSetupPage *_setupPage = nullptr;
+ OwncloudHttpCredsPage *_httpCredsPage = nullptr;
+ Flow2AuthCredsPage *_flow2CredsPage = nullptr;
+ TermsOfServiceWizardPage *_termsOfServicePage = nullptr;
+ OwncloudAdvancedSetupPage *_advancedSetupPage = nullptr;
OwncloudWizardResultPage *_resultPage = nullptr;
AbstractCredentialsWizardPage *_credentialsPage = nullptr;
- WebViewPage *_webViewPage = nullptr;
+ WebViewPage*_webViewPage = nullptr;
QStringList _setupLog;
#ifdef WITH_WEBENGINE
Page_WebView,
#endif // WITH_WEBENGINE
+ Page_TermsOfService,
Page_AdvancedSetup,
};
--- /dev/null
+/*
+ * Copyright (C) by Matthieu Gallien <matthieu.gallien@nextcloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "termsofservicewizardpage.h"
+
+#include "account.h"
+#include "owncloudsetupwizard.h"
+#include "wizard/owncloudwizard.h"
+#include "wizard/owncloudwizardcommon.h"
+#include "connectionvalidator.h"
+
+#include <QVBoxLayout>
+#include <QDesktopServices>
+
+namespace OCC {
+
+OCC::TermsOfServiceWizardPage::TermsOfServiceWizardPage()
+ : QWizardPage()
+{
+ _layout = new QVBoxLayout(this);
+}
+
+void OCC::TermsOfServiceWizardPage::initializePage()
+{
+}
+
+void OCC::TermsOfServiceWizardPage::cleanupPage()
+{
+}
+
+int OCC::TermsOfServiceWizardPage::nextId() const
+{
+ return WizardCommon::Page_AdvancedSetup;
+}
+
+bool OCC::TermsOfServiceWizardPage::isComplete() const
+{
+ return false;
+}
+
+void TermsOfServiceWizardPage::slotPollNow()
+{
+ _termsOfServiceChecker = new TermsOfServiceChecker{_ocWizard->account(), this};
+
+ connect(_termsOfServiceChecker, &TermsOfServiceChecker::done, this, &TermsOfServiceWizardPage::termsOfServiceChecked);
+ _termsOfServiceChecker->start();
+}
+
+void TermsOfServiceWizardPage::termsOfServiceChecked()
+{
+ if (_termsOfServiceChecker && _termsOfServiceChecker->needToSign()) {
+ QDesktopServices::openUrl(_ocWizard->account()->url());
+ } else {
+ _ocWizard->successfulStep();
+ delete _termsOfServiceChecker;
+ _termsOfServiceChecker = nullptr;
+ }
+}
+
+}
--- /dev/null
+/*
+ * Copyright (C) by Matthieu Gallien <matthieu.gallien@nextcloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#ifndef TERMSOFSERVICEWIZARDPAGE_H
+#define TERMSOFSERVICEWIZARDPAGE_H
+
+#include <QWizardPage>
+
+class QVBoxLayout;
+
+namespace OCC {
+
+class OwncloudWizard;
+class TermsOfServiceChecker;
+
+class TermsOfServiceWizardPage : public QWizardPage
+{
+ Q_OBJECT
+public:
+ TermsOfServiceWizardPage();
+
+ void initializePage() override;
+ void cleanupPage() override;
+ [[nodiscard]] int nextId() const override;
+ [[nodiscard]] bool isComplete() const override;
+
+Q_SIGNALS:
+ void connectToOCUrl(const QString &);
+ void pollNow();
+
+private Q_SLOTS:
+ void slotPollNow();
+ void termsOfServiceChecked();
+
+private:
+ QVBoxLayout *_layout = nullptr;
+ OwncloudWizard *_ocWizard = nullptr;
+ TermsOfServiceChecker *_termsOfServiceChecker = nullptr;
+};
+
+} // namespace OCC
+
+#endif // TERMSOFSERVICEWIZARDPAGE_H
}
int WebViewPage::nextId() const {
- return WizardCommon::Page_AdvancedSetup;
+ return WizardCommon::Page_TermsOfService;
}
bool WebViewPage::isComplete() const {